// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial

import { DemoPalette, Page, SpinBox, Label, ComboBox, PushButton } from "./common.slint";
import { PrinterQueue } from "./printer_queue.slint";

export component ScanPage inherits Page {
    has-back-button: true;
    header: @tr("Scan");

    GridLayout {
        padding-top: 46px /* header line height in design */
                     + /* extra top-padding in design */ 27px;
        spacing: 24px;
        Row {
            Text {
                text: @tr("Choose Settings");
                color: DemoPalette.secondary-foreground-color;
                font-size: DemoPalette.base-font-size * 1.125;
                font-weight: 800;
            }
        }
        Row {
            Label { text: @tr("Copies"); }
            SpinBox {
                value: 1;
                minimum: 1;
            }

            Rectangle {}

            Label { text: @tr("Size"); }
            ComboBox {
                value: @tr("Original");
                choices: [@tr("Original"), @tr("A4")];
            }
        }
        Row {
            Label { text: @tr("Quality"); }
            ComboBox {
                value: @tr("Best");
                choices: [@tr("Best"), @tr("Medium"), @tr("Draft")];
            }

            Rectangle {}

            Label { text: @tr("Format"); }
            ComboBox {
                value: @tr("PDF");
                choices: [@tr("PDF"), @tr("JPEG"), @tr("PNG")];
            }
        }
        Row {
            Label { text: @tr("Color"); }
            ComboBox {
                value: @tr("Grayscale");
                choices: [@tr("Grayscale"), @tr("RGB"), @tr("YCMB")];
            }

            Rectangle {}

            Label { text: @tr("Save to"); }
            ComboBox {
                value: @tr("Desktop");
                choices: [@tr("Desktop")];
            }
        }
         Row {
            Rectangle {
                colspan: 3;
            }
            HorizontalLayout {
                col: 3;
                colspan: 2;

                Rectangle {
                    horizontal-stretch: 0;
                    width: 10%;
                }
                PushButton {
                    icon: @image-url("images/scan.svg");
                    text: @tr("Start scanning");
                    clicked => {
                        PrinterQueue.start-job(@tr("Scan"));
                    }
                }
                Rectangle {
                    horizontal-stretch: 0;
                    width: 10%;
                }
            }
        }
        Row { Rectangle {} }
    }
}
